package com.gxa.admin.controller;


import com.gxa.common.vo.PageRecv;
import com.gxa.common.vo.R;
import com.gxa.common.vo.ResultVo;
import com.gxa.modules.pojo.Role;
import com.gxa.modules.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api(value = "角色管理接口",tags = "（李晨）角色管理接口")
@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired(required = false)
    RoleService roleService;

   //@RequiresPermissions("role")
    @ApiOperation(value = "获取所有角色（分页）", notes = "获取所有角色（分页）", response = R.class)
    @PostMapping("/getRolePage")
    public ResultVo getRolePage(@RequestBody PageRecv pageRecv){
        ResultVo r=roleService.getRolePage(pageRecv);
        return r;
    }

    @ApiOperation(value = "添加角色", notes = "添加角色", response = R.class)
    @PostMapping("/addRole")
    public ResultVo addRole(@RequestBody Role role){
        ResultVo r=roleService.addRole(role);
        return r;
    }

    @ApiOperation(value = "修改角色", notes = "修改角色", response = R.class)
    @PostMapping("/modifyRole")
    public ResultVo modifyRole(@RequestBody Role role){
        ResultVo r=roleService.modifyRole(role);
        return r;
    }


    @ApiOperation(value = "删除角色", notes = "删除角色", response = R.class)
    @PostMapping("/delRole")
    public ResultVo delRole(@RequestBody Role role){
        ResultVo r=roleService.delRole(role);
        return r;
    }



}
